package com.hakim.wfb.customer.service.impl;

import com.hakim.wfb.biz.CreditPointBiz;
import com.hakim.wfb.biz.PointOrderBiz;
import com.hakim.wfb.customer.params.order.GetOrderListParameter;
import com.hakim.wfb.customer.result.order.OrderListView;
import com.hakim.wfb.customer.service.OrderService;
import com.hakim.wfb.dao.CreditPointDao;
import com.hakim.wfb.dao.OrderListDao;
import com.hakim.wfb.dao.UserDao;
import com.hkfs.fundamental.api.data.ListResultEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by lenovo on 2017/7/15.
 */
@Service("orderService")
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderListDao orderListDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private CreditPointBiz creditPointBiz;

    @Autowired
    private CreditPointDao creditPointDao;

    @Autowired
    private PointOrderBiz pointOrderBiz;

    @Override
    public ListResultEx<OrderListView> list(GetOrderListParameter param) {
        ListResultEx<OrderListView> res = new ListResultEx<OrderListView>();
        try {
            List<OrderListView> reList = orderListDao.list(param);
            res.setTotalCount(reList.size());
            res.setDataList(reList);
            return res.makeSuccessResult();
        } catch (Exception e) {
            return res.makeFailedResult(e.getMessage());
        }
    }
}
